<template>
	<view class="comment">
		<!-- 已公示页面展示内容 -->
		<!-- <view v-if="record.length > 0"> -->
		<view v-if="true">
			<view v-if="detail.is_solve == '2' && detail.is_appeal == '2' && detail.is_comment == 2">
				<view class="finish">
					<view class="img-wrap">
						<u-image width="103rpx" height="100rpx" src="/static/image/home/icon_fabu.png"></u-image>
					</view>
					<view class="hint">
						<view>此诉求已反馈，</view>
						<view>点击“跟进记录”查看详情。</view>
					</view>
				</view>
			</view>
			<!-- 已公示页面展示内容 -->
			<view v-if="detail.is_solve == 2 && detail.is_appeal == 1 && detail.is_comment != 1">
				<view class="finish">
					<view class="img-wrap">
						<u-image width="103rpx" height="100rpx" src="/static/image/home/icon_fabu.png"></u-image>
					</view>
					<view class="hint">
						<view>此诉求已发布公示，</view>
						<view>点击“跟进记录”查看详情。</view>
					</view>
				</view>
			</view>
			<!-- 已公示页面展示内容 -->
			<!-- <view v-if="detail.is_comment == 1"> -->
			<!-- <view>
				<view class="finish">
					<view class="img-wrap">
						<u-image width="103rpx" height="100rpx" src="/static/image/pinglun.png"></u-image>
					</view>
					<view class="hint">
						<view>您以为此诉求提交评论，</view>
						<view>点击“跟进记录”查看详情。</view>
					</view>
				</view>
			</view> -->
			<!-- 反馈信息区域 -->
			<!-- <view v-if="detail.is_comment == 2"> -->
				<view>
				<view v-for="item in detail.record" :key="item.id">
					<view class="feedback-text" v-if="item.type == 2">
						<view class="head">
							{{item.now_organization_classify}} {{item.now_organization_name}} 诉求反馈：
						</view>
						<view class="content">
							{{item.message}}
						</view>
						<view class="info">
							<text class="time">{{item.updatetime | formatDate}}</text>
							<!-- <text class="copy-btn" @click="copy">复制</text> -->
						</view>
					</view>
					<!-- 反馈信息区域 -->
					<view class="feedback-text" v-if="item.type == 3">
						<view class="head">
							中台管理员 {{item.now_organization_name}} 提交公示：
						</view>
						<view class="content">
							{{item.message}}
						</view>
						<view class="info">
							<text class="time">{{item.updatetime || formatDate}}</text>
							<!-- <text class="copy-btn" @click="copy">复制</text> -->
						</view>
					</view>
				</view>
				<view class="title-tools">
					<title-tools title="评论" fontSize="30rpx"></title-tools>
				</view>
				<view class="input">
					<u-input class="textarea-input" :custom-style="inputCustomStyle" v-model="commont" maxlength="10000"
						height="400" type="textarea" :clearable="false"></u-input>
				</view>
				<view class="btn">
					<u-button @click="handleClick" :custom-style="customStyle2">提交
					</u-button>
				</view>
			</view>
			
		</view>
		<!-- <u-empty v-else text="暂无记录" mode="data"></u-empty> -->
	</view>
</template>

<script>
	import TitleTools from '@/components/title-tools/TitleTools.vue'
	import { apiSetComment } from '@/api/publicity/publicity.js'
	export default {
		name: 'Comment',
		components: {
			TitleTools
		},
		props: {
			record: {
				type: Array,
				default() {
					return []
				}
			},
			detail: {
				type: Object,
				default() {
					return {}
				}
			},
			type: {
				type: String,
				default: ''
			}
		},
		data() {
			return {
				commont: '',
				//文本域样式
				inputCustomStyle: {
					textIndent: '30rpx',
					overflowY: 'auto',
					borderRadius: '10rpx',
					backgroundColor: '#EAF1F9'
				},
				//提交反馈按钮样式
				customStyle2: {
					fontSize: '40rpx',
					color: '#fff',
					backgroundColor: '#196EFF',
					borderRadius: '20rpx'
				},
			}
		},
		methods: {
			async handleClick () {
				if (this.commont) {
					const that = this;
					await this.apiSetComment();
					uni.$emit('updateData');
					that.$Router.back(1);
					// uni.showToast({
					// 	title: '提交成功！',
					// 	success() {
							
					// 	}
					// })
				} else {
					uni.showToast({
						title: '请填写评论!',
					})
				}
			},
			//提交评论
			async apiSetComment () {
				const res = await apiSetComment(this.detail.id, this.commont);
			}
		}
	}
</script>

<style lang="scss" scoped>
	.comment {
		// min-height: 50rpx;
	}

	.finish {
		display: flex;
		align-items: center;
		padding: 80rpx 60rpx 80rpx 80rpx;

		.img-wrap {
			flex-shrink: 0;
		}

		.hint {
			display: block;
			margin-left: 30rpx;
			font-size: 30rpx;
			color: #000000;
		}
	}

	// 反馈信息区域样式
	.feedback-text {
		padding: 30rpx;
		margin: 0 auto;
		margin-top: 50rpx;
		margin-bottom: 20rpx;
		width: 630rpx;
		background: #EAF1F9;
		border-radius: 10rpx;

		.head {
			font-size: 30rpx;
			font-weight: 500;
			color: #000000;
		}

		.content {
			margin-top: 29rpx;
			font-size: 28rpx;
			color: #000000;
		}

		.info {
			margin-top: 28rpx;

			.time {
				font-size: 24rpx;
				color: #000000;
			}

			.copy-btn {
				margin-left: 30rpx;
				font-size: 24rpx;
				color: #196EFF;
			}
		}
	}

	.title-tools {
		padding: 10rpx 40rpx;
	}

	.input {
		padding: 0 40rpx;
		margin-top: 0rpx;
	}

	.btn {
		padding: 20rpx 40rpx;
	}
</style>
